﻿<phone:PhoneApplicationPage xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                            xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                            xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                            xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                            xmlns:Behaviors="clr-namespace:WP7Contrib.View.Controls.Behaviors;assembly=WP7Contrib.View.Controls"
                            xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
                            xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.WP7"
                            xmlns:Microsoft_Phone_Controls_Maps="clr-namespace:Microsoft.Phone.Controls.Maps;assembly=Microsoft.Phone.Controls.Maps"
                            x:Class="BingMaps.View.RoutePage"
                            FontFamily="{StaticResource PhoneFontFamilyNormal}"
                            FontSize="{StaticResource PhoneFontSizeNormal}"
                            Foreground="{StaticResource PhoneForegroundBrush}"
                            SupportedOrientations="Portrait"
                            Orientation="Portrait"
                            mc:Ignorable="d"
                            d:DesignHeight="768"
                            d:DesignWidth="480"
                            shell:SystemTray.IsVisible="True"
                            DataContext="{Binding RouteViewModel, Source={StaticResource Locator}}">

    <Grid x:Name="LayoutRoot"
          Background="Transparent"
          Margin="0,0,0,-72">
        <!--Pivot Control-->
        <controls:Pivot Title="BING MAPS SERVICE DEMO"
                        Margin="0,0,0,72">
            <controls:PivotItem Header="By Address">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="200" />
                        <ColumnDefinition Width="100*" />
                    </Grid.ColumnDefinitions>
                    <TextBlock TextWrapping="Wrap"
                                       Text="Start Country Region:"
                                       VerticalAlignment="Center" />
                    <TextBox Grid.Column="1" x:Name="StartAddressCountryRegion"
                                     TextWrapping="Wrap"
                                     Text="{Binding StartAddress.CountryRegion, Mode=TwoWay}"
                                     VerticalAlignment="Center" />
                    <TextBlock Grid.Row="1" TextWrapping="Wrap"
                                       Text="Start Admin District:"
                                       VerticalAlignment="Center" />
                    <TextBox Grid.Row="1" Grid.Column="1" x:Name="StartAddressAdminDistrict"
                                     TextWrapping="Wrap"
                                     Text="{Binding StartAddress.AdminDistrict, Mode=TwoWay}"
                                     VerticalAlignment="Center" />
                    <TextBlock Grid.Row="2" TextWrapping="Wrap"
                                       Text="Start Postal Code:"
                                       VerticalAlignment="Center" />
                    <TextBox Grid.Row="2" Grid.Column="1" x:Name="StartAddressPostalCode"
                                     TextWrapping="Wrap"
                                     Text="{Binding StartAddress.PostalCode, Mode=TwoWay}"
                                     VerticalAlignment="Center" />
                    <TextBlock Grid.Row="3" TextWrapping="Wrap"
                                       Text="Finish Country Region:"
                                       VerticalAlignment="Center" />
                    <TextBox Grid.Row="3" Grid.Column="1" x:Name="FinishAddressCountryRegion"
                                     TextWrapping="Wrap"
                                     Text="{Binding FinishAddress.CountryRegion, Mode=TwoWay}"
                                     VerticalAlignment="Center" />
                    <TextBlock Grid.Row="4" TextWrapping="Wrap"
                                       Text="Finish Admin District:"
                                       VerticalAlignment="Center" />
                    <TextBox Grid.Row="4" Grid.Column="1" x:Name="FinishAddressAdminDistrict"
                                     TextWrapping="Wrap"
                                     Text="{Binding FinishAddress.AdminDistrict, Mode=TwoWay}"
                                     VerticalAlignment="Center" />
                    <TextBlock Grid.Row="5" TextWrapping="Wrap"
                                       Text="Finish Postal Code:"
                                       VerticalAlignment="Center" />
                    <TextBox Grid.Row="5" Grid.Column="1" x:Name="FinishAddressPostalCode"
                                     TextWrapping="Wrap"
                                     Text="{Binding FinishAddress.PostalCode, Mode=TwoWay}"
                                     VerticalAlignment="Center" />
                    <Button Grid.Row="6" Grid.Column="1" Content="Route"
                            cmd:ButtonBaseExtensions.Command="{Binding SelectCalculateRouteByAddressesCommand}"
                            HorizontalAlignment="Right"
                            VerticalAlignment="Top"
                            Height="77" />
                    <TextBlock Grid.Row="6" Grid.ColumnSpan="2"
                               TextWrapping="Wrap"
                               Name="AddressStatus"
                               Text="{Binding AddressStatus}"
                               VerticalAlignment="Center" HorizontalAlignment="Left" Width="330" />
                </Grid>
            </controls:PivotItem>
            <controls:PivotItem Header="By Landmark">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="200" />
                        <ColumnDefinition Width="100*" />
                    </Grid.ColumnDefinitions>
                    <TextBlock TextWrapping="Wrap"
                                       Text="Start Area Name:"
                                       VerticalAlignment="Center" />
                    <TextBox Grid.Column="1" x:Name="StartLandmarkAreaName"
                                     TextWrapping="Wrap"
                                     Text="{Binding StartLandmark.AreaName, Mode=TwoWay}"
                                     VerticalAlignment="Center" />
                    <TextBlock Grid.Row="1" TextWrapping="Wrap"
                                       Text="Start Postal Code:"
                                       VerticalAlignment="Center" />
                    <TextBox Grid.Row="1" Grid.Column="1" x:Name="StartLandmarkPostalCode"
                                     TextWrapping="Wrap"
                                     Text="{Binding StartLandmark.PostalCode, Mode=TwoWay}"
                                     VerticalAlignment="Center" />
                    <TextBlock Grid.Row="2" TextWrapping="Wrap"
                                       Text="Finish Area Name:"
                                       VerticalAlignment="Center" />
                    <TextBox Grid.Row="2" Grid.Column="1" x:Name="FinishLandmarkAreaName"
                                     TextWrapping="Wrap"
                                     Text="{Binding FinishLandmark.AreaName, Mode=TwoWay}"
                                     VerticalAlignment="Center" />
                    <TextBlock Grid.Row="3" TextWrapping="Wrap"
                                       Text="Finish Postal Code:"
                                       VerticalAlignment="Center" />
                    <TextBox Grid.Row="3" Grid.Column="1" x:Name="FinishLandmarkPostalCode"
                                     TextWrapping="Wrap"
                                     Text="{Binding FinishLandmark.PostalCode, Mode=TwoWay}"
                                     VerticalAlignment="Center" />
                    <Button Grid.Row="4" Grid.Column="1" Content="Route"
                            cmd:ButtonBaseExtensions.Command="{Binding SelectCalculateRouteByLandmarksCommand}"
                            HorizontalAlignment="Right"
                            VerticalAlignment="Top"
                            Height="77" />
                    <TextBlock Grid.Row="4" Grid.ColumnSpan="2"
                               TextWrapping="Wrap"
                               Name="LandmarkStatus"
                               Text="{Binding LandmarkStatus}"
                               VerticalAlignment="Center" HorizontalAlignment="Left" Width="330" />
                    
                </Grid>
            </controls:PivotItem>
            <controls:PivotItem Header="By Point">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="200" />
                        <ColumnDefinition Width="100*" />
                    </Grid.ColumnDefinitions>
                    <TextBlock TextWrapping="Wrap"
                                       Text="Start Latitude:"
                                       VerticalAlignment="Center" />
                    <TextBox Grid.Column="1" x:Name="StartPointLatitude"
                                     TextWrapping="Wrap"
                                     Text="{Binding StartPoint.Latitude, Mode=TwoWay}"
                                     VerticalAlignment="Center" />
                    <TextBlock Grid.Row="1" TextWrapping="Wrap"
                                       Text="Start Longitude:"
                                       VerticalAlignment="Center" />
                    <TextBox Grid.Row="1" Grid.Column="1" x:Name="StartPointLongitude"
                                     TextWrapping="Wrap"
                                     Text="{Binding StartPoint.Longitude, Mode=TwoWay}"
                                     VerticalAlignment="Center" />
                    <TextBlock Grid.Row="2" TextWrapping="Wrap"
                                       Text="Finish Latitude:"
                                       VerticalAlignment="Center" />
                    <TextBox Grid.Row="2" Grid.Column="1" x:Name="FinishPointLatitude"
                                     TextWrapping="Wrap"
                                     Text="{Binding FinishPoint.Latitude, Mode=TwoWay}"
                                     VerticalAlignment="Center" />
                    <TextBlock Grid.Row="3" TextWrapping="Wrap"
                                       Text="Finish Longitude:"
                                       VerticalAlignment="Center" />
                    <TextBox Grid.Row="3" Grid.Column="1" x:Name="FinishPointLongitude"
                                     TextWrapping="Wrap"
                                     Text="{Binding FinishPoint.Longitude, Mode=TwoWay}"
                                     VerticalAlignment="Center" />
                    <Button Grid.Row="4" Grid.Column="1" Content="Route"
                            cmd:ButtonBaseExtensions.Command="{Binding SelectCalculateRouteByPointsCommand}"
                            HorizontalAlignment="Right"
                            VerticalAlignment="Top"
                            Height="77" />
                    <TextBlock Grid.Row="4" Grid.ColumnSpan="2"
                               TextWrapping="Wrap"
                               Name="PointStatus"
                               Text="{Binding PointStatus}"
                               VerticalAlignment="Center" HorizontalAlignment="Left" Width="330" />
                </Grid>
            </controls:PivotItem>
            <controls:PivotItem Header="Major Roads"
                                Margin="12,28,12,0">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70" />
                        <RowDefinition Height="70*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="200" />
                        <ColumnDefinition Width="100*" />
                    </Grid.ColumnDefinitions>
                    <TextBlock TextWrapping="Wrap"
                               Text="Area Name:"
                               VerticalAlignment="Center" />
                    <TextBox Grid.Column="1" x:Name="MajorRoadsAreaName"
                             TextWrapping="Wrap"
                             Text="{Binding MajorRoads.AreaName, Mode=TwoWay}"
                             VerticalAlignment="Center" />
                    <TextBlock Grid.Row="1" TextWrapping="Wrap"
                               Text="Postal Code:"
                               VerticalAlignment="Center" />
                    <TextBox Grid.Row="1" Grid.Column="1" x:Name="MajorRoadsPostalCode"
                             TextWrapping="Wrap"
                             Text="{Binding MajorRoads.PostalCode, Mode=TwoWay}"
                             VerticalAlignment="Center" />
                    <Button Grid.Row="2" Grid.Column="1" Content="Roads"
                            cmd:ButtonBaseExtensions.Command="{Binding SelectCalculateMajorRoadsForLandmarkCommand}"
                            HorizontalAlignment="Right"
                            VerticalAlignment="Top"
                            Height="77" />
                    <TextBlock Grid.Row="2" Grid.ColumnSpan="2"
                               TextWrapping="Wrap"
                               Name="MajorRoadStatus"
                               Text="{Binding MajorRoadsStatus}"
                               VerticalAlignment="Center" HorizontalAlignment="Left" Width="330" />

                </Grid>
            </controls:PivotItem>
            <controls:PivotItem Header="Directions">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="120" />
                        <RowDefinition Height="50" />
                        <RowDefinition Height="415" />
                    </Grid.RowDefinitions>
                    <StackPanel Orientation="Vertical" d:LayoutOverrides="Height">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="150"></ColumnDefinition>
                                <ColumnDefinition Width="*"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="30"></RowDefinition>
                                <RowDefinition Height="30"></RowDefinition>
                                <RowDefinition Height="30"></RowDefinition>
                                <RowDefinition Height="30"></RowDefinition>
                                <RowDefinition Height="30"></RowDefinition>
                                <RowDefinition Height="30*"></RowDefinition>
                                <RowDefinition Height="30"></RowDefinition>
                                <RowDefinition Height="30"></RowDefinition>
                                <RowDefinition Height="30"></RowDefinition>                                
                            </Grid.RowDefinitions>
                            <TextBlock Text="Distance Units:" />
                            <TextBlock Text="{Binding SearchResult.DistanceUnit}" Foreground="LightGreen"
                               TextAlignment="Right" Padding="0,0,20,0" Grid.Column="1" />
                            <TextBlock Text="Duration Units:" Grid.Row="1" />
                            <TextBlock Text="{Binding SearchResult.DurationUnit}" Foreground="LightGreen"
                               TextAlignment="Right" Padding="0,0,20,0" Grid.Column="1" Grid.Row="1" />
                            <TextBlock Text="Travel Distance:" Grid.Row="2" />
                            <TextBlock Text="{Binding SearchResult.TravelDistance}" Foreground="LightGreen"
                               TextAlignment="Right" Padding="0,0,20,0" Grid.Column="1" Grid.Row="2" />
                            <TextBlock Text="Travel Duration:" Grid.Row="3" />
                            <TextBlock Text="{Binding SearchResult.TravelDuration}" Foreground="LightGreen"
                               TextAlignment="Right" Padding="0,0,20,0" Grid.Column="1" Grid.Row="3" />
                        </Grid>
                    </StackPanel>
                    <TextBlock Grid.Row="1"
                               Text="Route Legs:"
                               VerticalAlignment="Center"
                               HorizontalAlignment="Left"/>
                    <ListBox Grid.Row="2" BorderThickness="3" BorderBrush="White"
                             Padding="5,5,5,5"
                             ItemsSource="{Binding SearchResult.RouteLegs}"
                             ItemTemplate="{StaticResource RouteLegsDataTemplate}"
                             ScrollViewer.VerticalScrollBarVisibility="Visible" />
                </Grid>
            </controls:PivotItem>
            <controls:PivotItem Header="Map">
            	<Microsoft_Phone_Controls_Maps:Map x:Name="searchresultsnearbymap"
            		CredentialsProvider="AoAYqsmU8fmEynSb1ehNUnBPFLkTAIgDPrkk0ZymU8i_ZI-ZK6UE80zYgCyPiDwo"
            		ZoomLevel="{Binding ZoomLevel, Mode=TwoWay}"   
            		Center="{Binding CurrentMapSearchCenterPoint, Mode=TwoWay}"
            		ZoomBarVisibility="Collapsed"
            		CopyrightVisibility="Visible"
            		AnimationLevel="UserInput"
            		HorizontalContentAlignment="Stretch"
            		VerticalContentAlignment="Stretch"
            		Grid.RowSpan="2"
            		Background="{StaticResource SemiOpaqueDarkBackBrush}">

                    <!--Need to add a map pin to show what your current position is on the map-->
            		<Microsoft_Phone_Controls_Maps:MapPolyline Stroke="Green"
            			Locations="{Binding SearchResult.Points}" 
            			StrokeThickness="6"
            			Opacity="0.7" />

            		<Microsoft_Phone_Controls_Maps:MapItemsControl x:Name="ResultsList"
            			ItemTemplate="{StaticResource MapPinDataTemplate}"
            			ItemsSource="{Binding ItineraryItems}" />
            	</Microsoft_Phone_Controls_Maps:Map>
            </controls:PivotItem>
        </controls:Pivot>
    </Grid>
</phone:PhoneApplicationPage>
